/*
 * Copyright(c) 2020-2100 万达信息股份有限公司 版权所有
 * WONDERS INFORMATION CO., LTD. ALL RIGHTS RESERVED.
 */

package com.wondersgroup;

/**
 * @author: huym
 * @version: 1.0
 * @date: 2020/12/9
 */
public class Dog implements Comparable<Dog> {

    int food;

    public Dog(int food) {
        this.food = food;
    }

    // 不推荐在Dog里面直接用比较方法，如果根据其他比较，那么需要修改，程序不灵活
    @Override
    public int compareTo(Dog dog) {
        if (this.food>dog.food) return 1;
        else if (this.food<dog.food) return -1;
        else return 0;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "food=" + food +
                '}';
    }
}